< previous page page_213 next page >

Page 213
Solution 19
The RASDIALPARAMS Structure
Let's start out by looking again at the structure:
typedef struct _RASDIALPARAMS {
   DWORD  dwSize;
   TCHAR  szEntryName[RAS_MaxEntryName + 1];
   TCHAR  szPhoneNumber[RAS_MaxPhoneNumber + 1];
   TCHAR  szCallbackNumber[RAS_MaxCallbackNumber + 1];
   TCHAR  szUserName[UNLEN + 1];
   TCHAR  szPassword[PWLEN + 1];
   TCHAR  szDomain[DNLEN + 1] ;
#if (WINVER >= 0x401)
   DWORD dwSubEntry;
   DWORD dwCallbackId;
#endif
} RASDIALPARAMS;
Two things are clear: First, we need to find the values of a number of constants. Next, we need to figure out how to deal with the dwSubEntry and dwCallbackId fields. What does the following term mean?
#if (WINVER >= 0x401)
   DWORD dwSubEntry;
   DWORD dwCallbackId;
#endif
The #if keyword is a conditional compilation block, similar to conditional compilation as supported by Visual Basic. It indicates that everything up to the #endif term will be included only if the compile time WINVER constant is greater than or equal to &H401. Clearly, version 4.01 of Windows added two new fields to this structure. How does the Win32 API know whether those two fields are present? It can tell based on the dwSize field! After all, those two fields add 8 bytes to the total size of the structure.

 
< previous page page_213 next page >